package indi.zhifa.study2025.test.kafka.producer.controller;

import indi.zhifa.engine.core.common.web.ann.ZhiFaRestController;
import indi.zhifa.study2025.test.kafka.producer.entity.KafkaData;
import indi.zhifa.study2025.test.kafka.producer.service.IKafkaSendData;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Slf4j
@Validated
@RequiredArgsConstructor
@Tag(name = "生产者")
@ZhiFaRestController
@RequestMapping("/kafka/produce")
public class KafkaProduceController {

    final IKafkaSendData mKafkaSendData;

    @PostMapping("/{topic}")
    public void sendAsync(@PathVariable("topic") String pTopic, @RequestBody KafkaData pKafkaData){
        mKafkaSendData.sendAsync(pTopic,pKafkaData);
    }
}
